//主从表tab选项卡标志位
var ACAB4F_Tab_Flag = -1;
//选择某一行
var ACAB4F_select_user_control_rowId = "";
//按钮事件新增或编辑
var ACAB4F_type = "";
//其他页面传到本页面参数
var ACAB4F_param = {};
//本页面传到其他页面参数
var ACAB4F_toparam = {};
//table选中数据，如无则默认第一条
var ACAB4F_rowCheckData = null;
//当前触发按钮
var ACAB4F_btn = "";
//上一次触发的按钮
var ACAB4F_prev_btn = "";
//树形节点选择
var ACAB4F_select_TreeNode = {};
//表格数据服务端分页或客户端分页 1:服务端 0:客户端
var ACAB4F_table_page = 0;

/*定义查询条件变量*/
/*declare query param begin*/
var ACAB4F_tem_LOGIN_ID = "";
var ACAB4F_tem_NICK_NAME = "";

/*declare query param end*/

/*定义下拉框集合定义*/
/*declare select options begin*/
var ACAB4F_ary_S_STATE = [{"MAIN_ID":"1","CN_NAME":"启用"},{"MAIN_ID":"0","CN_NAME":"禁用"}];

/*declare select options end*/

/*文件附件格式*/
/*input param fileinfo begin*/

/*input param fileinfo end*/

/*绑定show监听事件*/
if(ACAB4F_Tab_Flag == -1){
	var ACAB4F_n = Get_RandomDiv("ACAB4F","");
	$(ACAB4F_n).bind("show", function(objTag){
		ACAB4F_Adjust_Sub_Sequ();	
	});
}

//设置主从表div顺序
function ACAB4F_Adjust_Sub_Sequ(){
	var temSubDivs = $("#content-main").find("div[data-id]");
	var MainDiv = $(Get_RandomDiv("ACAB4F",""));
	for(i = 0; i < temSubDivs.length; i++) {
		if(ACAB4F_Is_Sub_Div(temSubDivs[i].id)){
			$(temSubDivs[i]).before($(MainDiv));
			break;
		}
	}
}

//判断是否sub子项div页面
function ACAB4F_Is_Sub_Div(temDivId){
    if(temDivId.indexOf("XX$TTT") == 0)
        return false;
    return false;
}

//主从表传递参数
function ACAB4F_param_set(){
	/*Main Subsuv Table Param Begin*/
    if(ACAB4F_param.hasOwnProperty("LOGIN_ID"))
        $("#ACAB4F_qry_LOGIN_ID").val(ACAB4F_param["LOGIN_ID"]);
    if(ACAB4F_param.hasOwnProperty("hidden_find")){
        $("#ACAB4F_qry_LOGIN_ID").attr("disabled", true);
    }
    if(ACAB4F_param.hasOwnProperty("NICK_NAME"))
        $("#ACAB4F_qry_NICK_NAME").val(ACAB4F_param["NICK_NAME"]);
    if(ACAB4F_param.hasOwnProperty("hidden_find")){
        $("#ACAB4F_qry_NICK_NAME").attr("disabled", true);
    }	
	/*Main Subsuv Table Param end*/
}

//业务逻辑数据开始
function ACAB4F_user_control_biz_start(inputparam) {
	layer.close(ly_index);
	ACAB4F_param = inputparam;
	//主从表传递参数
	ACAB4F_param_set();	
    /*biz begin*/
	ACAB4F_init_user_control();
	
    /*biz end*/
}

/*业务函数步骤*/
/*biz step begin*/
/*biz step end*/

/*查找框函数*/
/*find qry fun begin*/

/*find qry fun end*/

/*页面结束*/
function ACAB4F_page_end(){
	ACAB4F_sub_show();
}

//按钮弹窗

//按钮定义
function ACAB4F_Upd_EvaFormatter(value, row, index) {
}

//用户显示列定义
var ACAB4F_user_control = [
	/*table column begin*/
    {
        title: '主键',
        field: 'MAIN_ID',
        sortable: true,
        visible: false,
        width: 40
    },
    {
        title: '登录账号',
        field: 'LOGIN_ID',
        sortable: true,
        width: 60
        ,formatter: set_s_decode
    },
    {
        title: '用户名称',
        field: 'NICK_NAME',
        sortable: true,
        width: 60
        ,formatter: set_s_decode
    }
];

//页面初始化
function ACAB4F_init_user_control() {
	$(window).resize(function () {
		  $('#ACAB4F_user_control_Events').bootstrapTable('resetView');
	});
	//用户查询条件初始化设置
	/*query conditions init begin*/
	
    /*query conditions init end*/
	
	$('#ACAB4F_btn_user_control_query').click();
}

//查询接口
function ACAB4F_user_control_query() {
    $('#ACAB4F_user_control_Events').bootstrapTable("removeAll");
	//以下为特殊字段列表查询，无特殊字段时不需要
	var inputdata = {
		"param_name": "N01_sel_t_user_info",
		"session_id": session_id,
		"login_id": login_id
		/*传递查询条件变量*/
        /*get query param begin*/
        ,"param_value1": s_encode(ACAB4F_tem_LOGIN_ID)
        ,"param_value2": s_encode(ACAB4F_tem_NICK_NAME)
        ,"param_value3": ""
        ,"param_value4": ""
		
        /*get query param end*/
	};
	ly_index = layer.load();
	if(ACAB4F_table_page == 1){
		inputdata = {"N01_sel_t_user_info":[]};
		ACAB4F_get_N01_sel_t_user_info(inputdata);
	}
	else{
		delete inputdata["pageNumber"];
		delete inputdata["pageSize"];
		get_ajax_baseurl(inputdata, "ACAB4F_get_N01_sel_t_user_info");
	}
}

//树形结构函数定义
/*tree function defined begin*/
/*tree function defined end*/

//查询结果
function ACAB4F_get_N01_sel_t_user_info(input) {
	layer.close(ly_index);
	//查询失败
    if (Call_QryResult(input.N01_sel_t_user_info) == false)
        return false;
    //树形结构函数调用
    /*tree function run begin*/

    /*tree function run end*/    
    ACAB4F_rowCheckData = null;
    //调整table各列宽度
    
	var s_data = input.N01_sel_t_user_info;
	ACAB4F_select_user_control_rowId = "";
    if(s_data.length > 0){
    	ACAB4F_rowCheckData = s_data[0]; 
    }
    //table对应的属性
    var temTableAtt = {};
    if(ACAB4F_table_page == 1){
    	temTableAtt["url"] = bizzUrl;
    	temTableAtt["method"] = "get";
    	temTableAtt["sidePagination"] = "server";
    	temTableAtt["queryParamsType"] = "limit";
    }
    else{
    	temTableAtt["url"] = null;
    	temTableAtt["method"] = null;
    	temTableAtt["sidePagination"] = null;
    	temTableAtt["queryParamsType"] = null;
    }
    $('#ACAB4F_user_control_Events').bootstrapTable('destroy');
    $("#ACAB4F_user_control_Events").bootstrapTable({
        uniqueId: 'main_id',
        search: 0,
        pagination: !0,
        showRefresh: 0,
        showToggle: 0,
        locale: "zh-CN",
        showColumns: 0,
        showExport: 0,
        exportDataType:"all",
        exportTypes:['excel'],
        iconSize: "outline",
        onClickRow: function (row, $element) {
            // 判断是否已选中
            if (ACAB4F_prev_btn == ACAB4F_btn && $($element).hasClass("changeColor")) {
                $('#ACAB4F_user_control_Events').find("tr.changeColor").removeClass('changeColor');
                ACAB4F_select_user_control_rowId = "";
            }
            else {
                // 未点击则，为当前行添加 class='changeColor'
                $('#ACAB4F_user_control_Events').find("tr.changeColor").removeClass('changeColor');
                $($element).addClass('changeColor');                　
                ACAB4F_select_user_control_rowId = $element.attr('data-index');
                
                //设置子表查询条件
                /*set child table qry begin*/
                
                /*set child table qry end*/
                ACAB4F_sub_show();
            }
        },
		onDblClickRow: function (row){
			if(ACAB4F_param.hasOwnProperty("target_name"))
			{
				$("#"+ACAB4F_param["target_id"]).val(eval("row."+ACAB4F_param["sourc_id"].toUpperCase()));
				$("#"+ACAB4F_param["target_name"]).val(s_decode(eval("row."+ACAB4F_param["sourc_name"].toUpperCase())));				
				layer.close(ACAB4F_param["ly_index"]);
			}
		},
        toolbar: "#ACAB4F_user_control_Toolbar",
        url: temTableAtt["url"],
        method: temTableAtt["method"],
        height:500,
        columns: ACAB4F_user_control,
        data: s_data,
        pageNumber: 1,
        pageSize: 10, // 每页的记录行数（*）
        pageList: [10,50,100,1000,2000], // 可供选择的每页的行数（*）
        queryParams: ACAB4F_user_control_queryParams,
        sidePagination: temTableAtt["sidePagination"],//"server", //服务端处理分页
	    queryParamsType : temTableAtt["queryParamsType"],//"limit",//设置为 ‘limit’ 则会发送符合 RESTFul 格式的参数.
        icons: {
            refresh: "glyphicon-repeat",
            toggle: "glyphicon-list-alt",
            columns: "glyphicon-list"
        },
        onPostBody:function(){
        },
        onLoadSuccess: function(input){
        	if(input.rows.length > 0)
        		ACAB4F_rowCheckData = input.rows[0]; 
        },
        onLoadError: function(err){
            console.log("error: "+err);
        },
        responseHandler:ACAB4F_Res_N01_sel_user_control
    });
	ACAB4F_page_end();
}

//设置参数
function ACAB4F_user_control_queryParams(inputdata){
	ly_index = layer.load();
	if(ACAB4F_table_page == 0)
		return null;
	var temdata = {
		"param_name": "N01_sel_t_user_info",
		"session_id": session_id,
		"login_id": login_id
		/*传递查询条件变量*/
        /*get query param begin*/
        ,"param_value1": s_encode(ACAB4F_tem_LOGIN_ID)
        ,"param_value2": s_encode(ACAB4F_tem_NICK_NAME)
        ,"param_value3": ""
        ,"param_value4": ""
        /*get query param end*/
	};	
	for (var key in temdata) {
		inputdata[key] = temdata[key];
    }
	if(inputdata.hasOwnProperty("offset") && inputdata.hasOwnProperty("limit")){
		inputdata["pageNumber"] = parseInt(inputdata["offset"] / inputdata["limit"]) + 1;
		inputdata["pageSize"] = inputdata["limit"];
	}
	else{
		inputdata["pageNumber"] = 0;
		inputdata["pageSize"] = 0;
	}
	return inputdata;
}

//获取接口数据
function ACAB4F_Res_N01_sel_user_control(input){
	layer.close(ly_index);
	//查询失败
    if (Call_QryResult(input.N01_sel_t_user_info) == false)
        return false;
    if(input["N01_sel_t_user_info"].length > 0)
    	ACAB4F_rowCheckData = input["N01_sel_t_user_info"][0];
    if(ACAB4F_table_page == 0)
		return null;
	else{ 
		var json_list = {};
		json_list["total"] = input["N01_sel_t_user_info_ROWS"];
		json_list["rows"] = input["N01_sel_t_user_info"];
		return json_list;
	}
}

//刷新按钮
$('#ACAB4F_btn_user_control_refresh').click(function () {
	/*重置查询条件变量*/
	/*refresh query param begin*/
    ACAB4F_tem_LOGIN_ID = "";
    ACAB4F_tem_NICK_NAME = "";

	/*refresh query param end*/

	/*重置下拉框集合定义*/
	/*refresh select options begin*/

	/*refresh select options end*/
	
	/*页面重置重新加载*/
	/*biz begin*/
    var inputdata = {
        "param_name": "N01_sel_t_code_regions_ByNodeID",
        "session_id": session_id,
        "login_id": login_id
        ,"param_value1":"0"
    };
    ly_index = layer.load();
    get_ajax_baseurl(inputdata, "ACAB4F_get_N01_sel_t_code_regions_ByNodeID");
	
    /*biz end*/
})

//查询按钮
$('#ACAB4F_btn_user_control_query').click(function () {
	/*设置查询条件变量*/
    /*set query param begin*/
    ACAB4F_tem_LOGIN_ID = $("#ACAB4F_qry_LOGIN_ID").val();
    ACAB4F_tem_NICK_NAME = $("#ACAB4F_qry_NICK_NAME").val();
	
    /*set query param end*/
	ACAB4F_user_control_query();
})

//vue回调
function ACAB4F_user_control_call_vue(objResult){
	//选择某条记录或自动选择第一条
	if (ACAB4F_select_user_control_rowId != "") 
		ACAB4F_rowCheckData = $("#ACAB4F_user_control_Events").bootstrapTable('getData')[ACAB4F_select_user_control_rowId];
	if(index_subhtml == "XXXTTT"){
	}
	/*查询条件弹窗子页面*/
    /*get find subvue bgein*/
    
	/*get find subvue end*/
	else if(index_subhtml == "sys_vue/t_button.vue"){
        var n = Get_RandomDiv("A673F2",objResult);
        layer.open({
            type: 1,
            area: ['1100px', '600px'],
            fixed: false, //不固定
            maxmin: true,
            content: $(n),
            success: function(layero, index){
            	ACAB4F_toparam["ly_index"] = index;
                loadScript_hasparam("sys_vue/t_button.js","A673F2_t_button_biz_start",ACAB4F_toparam);
            },
            end: function(){
                $(n).hide();
            }
        });
    }
	/*tab页显示子页面*/
	/*get tab subvue begin*/
}

//弹窗1
function ACAB4F_open_to_url1(temindex_subhtml,temrandom_subhtml,temparam){
	ACAB4F_btn = "";
	ACAB4F_prev_btn = "";
	index_subhtml = s_decode(temindex_subhtml);
	inputrandom = s_decode(temrandom_subhtml);
	//本页面传到其他页面参数
	ACAB4F_toparam = JSON.parse(s_decode(temparam));
	if(loadHtmlSubVueFun(index_subhtml,"ACAB4F_user_control_call_vue") == true){
		var n = Get_RandomDiv(inputrandom,"");
		layer.open({
			type: 1,
			area: ['1100px', '600px'],
			fixed: false, //不固定
			maxmin: true,
			content: $(n),
			success: function(layero, index){
				ACAB4F_toparam["ly_index"] = index;
				eval(inputrandom+"_param = {}");
				for(var key in ACAB4F_toparam)
					eval(inputrandom+"_param['"+key+"'] = '"+ACAB4F_toparam[key]+"'");
				//参数传递并赋值
				eval(inputrandom+"_param_set()");
				var tbName = "";
				if(index_subhtml.indexOf("/") == -1)
					tbName = index_subhtml.substring(0,index_subhtml.indexOf(".vue"));
				else
					tbName = index_subhtml.substring(index_subhtml.lastIndexOf("/")+1,index_subhtml.indexOf(".vue"));
				eval(inputrandom+"_init_"+tbName.replace("_$","")+"()");
			},
			end: function(){
				$(n).hide();
			}
		});	
	}
}

//2:系统内tab页
function ACAB4F_open_to_url2(temindex_subhtml,temrandom_subhtml,temparam){
	ACAB4F_btn = "";
	ACAB4F_prev_btn = "";
	index_subhtml = s_decode(temindex_subhtml);
	inputrandom = s_decode(temrandom_subhtml);
	//调用或加载左侧菜单并click
	Add_No_Show_Menu(index_subhtml,inputrandom,JSON.parse(s_decode(temparam)));	
}

//3：浏览器tab页
function ACAB4F_open_to_url3(temindex_subhtml,temrandom_subhtml,temparam){
	ACAB4F_btn = "";
	ACAB4F_prev_btn = "";
	index_subhtml = s_decode(temindex_subhtml);
	inputrandom = s_decode(temrandom_subhtml);
}

//按钮事件触发页面跳转，1:弹窗、2:系统内tab页、3：浏览器tab页
/*open new page begin*/
/*open new page end*/

//打开新页面
function ACAB4F_open_url(objTag,iIndex){
	//弹窗
	if(iIndex == 0)
		ACAB4F_open_to_url1($(objTag).attr("param1"),$(objTag).attr("param2"),$(objTag).attr("param3"));
	//系统内tab页
	else if(iIndex == 1)
		ACAB4F_open_to_url2($(objTag).attr("param1"),$(objTag).attr("param2"),$(objTag).attr("param3"));
	//浏览器tab页
	else if(iIndex == 2)
		ACAB4F_open_to_url3($(objTag).attr("param1"),$(objTag).attr("param2"),$(objTag).attr("param3"));
}

//选择多行数据进行业务操作
function ACAB4F_sel_row_user_control(){
	//获得选中行
	var checkedbox= $("#ACAB4F_user_control_Events").bootstrapTable('getSelections'); 
	//将选中行数据转成jsonStr
	var jsonStr=JSON.stringify(checkedbox);
	//将jsonStr转成jsonObject对象	 
	var jsonObject=jQuery.parseJSON(jsonStr);
	return jsonObject;
	//接着就可以遍历jsonObject数组对象，取出并操作数据
}

//权限全选
$("#ACAB4F_Check_All").change(function(objTag){
	var SUB_NAME = $("input[name='ACAB4F_user_control_rd']:checked").val();
	$.each($("#"+SUB_NAME).find("input[type='checkbox']"), function (i, obj) {
		if($("#ACAB4F_Check_All").is(":checked")){
			obj.checked = true;
		}else{
			obj.checked = false;
		}
	});
});

//选中菜单组
function ACAB4F_menu_group_check(objTag){
	var SUB_NAME = $(objTag).val();
	$.each($("#"+SUB_NAME).find("input[type='checkbox']"), function (i, obj) {
		if($(objTag).is(":checked")){
			obj.checked = true;
		}else{
			obj.checked = false;
		}
	});
}

//子项选中
$("input[type=radio][name=ACAB4F_user_control_rd]").bind("change",function(){
	ACAB4F_sub_show();
});

//隐藏所有sub
function ACAB4F_sub_hidden(SUB_NAME){
	$("#ACAB4F_sub_role").hide();
	$("#ACAB4F_sub_menu").hide();
	$("#ACAB4F_sub_content").hide();
	$("#ACAB4F_sub_proc").hide();
	$("#ACAB4F_sub_btn").hide();
	$("#"+SUB_NAME).show();
}

//显示权限控制子项
function ACAB4F_sub_show(){
	//选择某条记录或自动选择第一条并传递参数
	if (ACAB4F_select_user_control_rowId != "") 
		rowData = $("#ACAB4F_user_control_Events").bootstrapTable('getData')[ACAB4F_select_user_control_rowId];
	else if(ACAB4F_rowCheckData != "" && ACAB4F_rowCheckData != null)
		rowData = ACAB4F_rowCheckData;
	else 
		rowData = $("#ACAB4F_user_control_Events").bootstrapTable('getData')[0];
	if(typeof(rowData) == "undefined")
		return; 
	$("#ACAB4F_def_user").html("选中用户:"+s_decode(rowData["LOGIN_ID"])+"=>"+s_decode(rowData["NICK_NAME"])+"");
	var SUB_NAME = $("input[name='ACAB4F_user_control_rd']:checked").val();
	ACAB4F_sub_hidden(SUB_NAME);
	
	if(SUB_NAME == "ACAB4F_sub_role")
		ACAB4F_A01_GGR334(rowData["MAIN_ID"]);
	else if(SUB_NAME == "ACAB4F_sub_menu")
		ACAB4F_A01_KKT774(rowData["MAIN_ID"]);
	else if(SUB_NAME == "ACAB4F_sub_content")
		ACAB4F_A01_TTTV32(rowData["MAIN_ID"]);
	else if(SUB_NAME == "ACAB4F_sub_proc")
		$("#ACAB4F_btn_sub_proc_query").click();
		//ACAB4F_A01_VVG321(rowData["MAIN_ID"]);
	else if(SUB_NAME == "ACAB4F_sub_btn")
		ACAB4F_A01_7TT4N0(rowData["MAIN_ID"]);
}

$("#ACAB4F_btn_sub_proc_query").click(function (){
	ACAB4F_A01_VVG321(rowData["MAIN_ID"]);
});

//请求按钮禁用接口权限
function ACAB4F_A01_7TT4N0(USER_MAIN_ID){
	var inputdata = {
			"param_name": "A01_7TT4N0",
			"session_id": session_id,
			"login_id": login_id
			,"param_value1":USER_MAIN_ID
	};
	ly_index = layer.load();
	get_ajax_baseurl(inputdata, "ACAB4F_get_A01_7TT4N0");
}

//获取按钮禁用接口权限
function ACAB4F_get_A01_7TT4N0(input){
	layer.close(ly_index);
	//查询失败
    if (Call_QryResult(input.A01_7TT4N0) == false)
        return false;
	$("#ACAB4F_sub_btn").html("");
	var GROUP_ID = "";
	var MENU_ID = "";
	var iCount = 0;
	$.each(input.A01_7TT4N0, function (i, obj) {
		var temMAIN_ID = obj["MAIN_ID"];
		var temMENU_NAME = s_decode(obj["MENU_NAME"]);
		var temGROUP_ID = obj["GROUP_ID"];
		var temMENU_ID = obj["MENU_ID"];
		var temBTN_CN_NAME = s_decode(obj["BTN_CN_NAME"]);
		var bGFlag = false;
		var temCheck = "";
		//添加组
		if(GROUP_ID != temGROUP_ID){
			var group_html = "<div>"
				+"<input id=\"ACAB4F_sbm_ck_"+temGROUP_ID.toString()+"\" onclick=\"ACAB4F_menu_group_check(this)\" "
				+"type=\"checkbox\" value=\"ACAB4F_sbm_"+temGROUP_ID.toString()+"\" >"  //checked=\"true\"
				+"<label style=\"margin-left: 10px;\" for=\"ACAB4F_sbm_ck_"+temGROUP_ID.toString()+"\">"+s_decode(obj["GROUP_CN_NAME"])+"</label>"
				+"</div>";
			GROUP_ID = temGROUP_ID;
			var menu_div = "<div style=\"margin-left: 10px;\" id=\"ACAB4F_sbm_"+temGROUP_ID.toString()+"\">";
			$("#ACAB4F_sub_btn").append(group_html);
			$("#ACAB4F_sub_btn").append(menu_div);
			bGFlag = true;
		}
		
		//添加菜单
		if(MENU_ID != temMENU_ID){
			iCount = 0;
			MENU_ID = temMENU_ID;
			var target_menu = "<div><input id=\"ACAB4F_sbmenu_"+temMENU_ID.toString()+"\" onclick=\"ACAB4F_menu_group_check(this)\" type=\"checkbox\" value=\"ACAB4F_sbmbtn_"+temMENU_ID+"\">"
		    	+"<label for=\"ACAB4F_sbmenu_"+temMENU_ID.toString()+"\">"+temMENU_NAME+"</label>"
		    	+"<a id=\"ACAB4F_btn_load_"+temMENU_ID.toString()+"\" onclick=\"ACAB4F_Load_t_button('"+temMENU_ID+"','"+temMENU_NAME+"')\"><i class=\"fa fa-cloud-download\"></i>加载</a>"
		    	+"</div>";
			var menu_div = "<div style=\"margin-left: 20px;\" id=\"ACAB4F_sbmbtn_"+temMENU_ID.toString()+"\">";			
			$("#ACAB4F_sub_btn").find("div[id='ACAB4F_sbm_"+temGROUP_ID.toString()+"']").append(target_menu);		
			$("#ACAB4F_sub_btn").find("div[id='ACAB4F_sbm_"+temGROUP_ID.toString()+"']").append(menu_div);
		}
		
		//添加菜单按钮
		if(temMAIN_ID != ""){
			if(obj["USER_MAIN_ID"] != "")
				temCheck = "checked=\"true\"";
			else
				temCheck = "";
			var target_btn = "<input id=\"ACAB4F_sub_btn_"+temMAIN_ID.toString()+"\" type=\"checkbox\" value=\""+temMAIN_ID+"\" "+temCheck+">"
		    	+"<label for=\"ACAB4F_sub_btn_"+temMAIN_ID.toString()+"\">"+temBTN_CN_NAME+"</label>";
			iCount ++;
			if(iCount % 5 == 0)
				target_btn += "<br>";
			$("#ACAB4F_sub_btn").find("div[id='ACAB4F_sbmbtn_"+temMENU_ID.toString()+"']").append(target_btn);
		}
	});
}

//加载页面按钮
function ACAB4F_Load_t_button(menu_id,menu_name){
//	var temparam = "{\"MENU_MAIN_ID\":\""+menu_id+"\",\"MENU_MAIN_ID_cn_name\":\""+menu_name+"\"}";	
//	index_subhtml = "sys_vue/t_button.vue";
//    random_subhtml = "A673F2";
//	ACAB4F_open_to_url1(index_subhtml,random_subhtml,temparam);
	var inputdata = {
			"param_name": "N01_sel_menu_info_ByID",
	        "session_id": session_id,
	        "login_id": login_id
	        ,"param_value1":menu_id
	};
	ly_index = layer.load();
	get_ajax_baseurl(inputdata, "ACAB4F_get_N01_sel_menu_info_ByID");
}
var ACAB4F_select_MENU_INFO = null;
//加载查询页面详情完成
function ACAB4F_get_N01_sel_menu_info_ByID(input){
	layer.close(ly_index);
	//查询失败
	if (Call_OpeResult(input.N01_sel_menu_info_ByID) == false)
		return false;
	
	ACAB4F_select_MENU_INFO = input.N01_sel_menu_info_ByID[0];
	var selfdiv = Get_RDivNoBuild(ACAB4F_select_MENU_INFO["S_DESC"],"")
	//页面已打开
	if($(selfdiv).length > 0){
		ACAB4F_Load_div("")
	}
	//先加载页面
	else{
		index_subhtml = s_decode(ACAB4F_select_MENU_INFO["MENU_URL"]);
		loadHtmlSubVueFun(index_subhtml,"ACAB4F_Load_div_Call_vue");
	}
}
//子div加载
function ACAB4F_Load_div_Call_vue(objResult){
	var n = Get_RandomDiv(ACAB4F_select_MENU_INFO["S_DESC"],objResult);
	$(n).hide();
	loadScript_hasparam(s_decode(ACAB4F_select_MENU_INFO["MENU_URL"]).replace(".vue",".js"),"ACAB4F_Load_div",{});
}
//批量写入t_button数据
function ACAB4F_Load_div(divResult){
	var selfdiv = Get_RDivNoBuild(ACAB4F_select_MENU_INFO["S_DESC"],"")
	var inputdata = {
			"param_name": "A01_NKJ001",
	        "session_id": session_id,
	        "login_id": login_id
	        ,"param_value1": ","
		    ,"param_value2": ","
	};
	
	var buttons = $(selfdiv).find('button');
	$.each(buttons, function (i, obj) {
		if(obj.id != "" && inputdata["param_value1"].indexOf(","+obj.id+",") == -1){
			inputdata["param_value1"] += obj.id+",";
			inputdata["param_value2"] += obj.textContent+",";
		}
	});
	inputdata["param_value1"] = s_encode(inputdata["param_value1"]);
	inputdata["param_value2"] = s_encode(inputdata["param_value2"]);
	inputdata["param_value3"] = ACAB4F_select_MENU_INFO["MAIN_ID"];
	ly_index = layer.load();
	get_ajax_baseurl(inputdata, "ACAB4F_get_A01_NKJ001");
}
//批量写入t_button数据结果
function ACAB4F_get_A01_NKJ001(input){
	layer.close(ly_index);
	//查询失败
	if (Call_OpeResult(input.A01_NKJ001) == false)
		return false;
	ACAB4F_sub_show();
}

//请求用户接口权限
function ACAB4F_A01_VVG321(USER_MAIN_ID){
	var inputdata = {
			"param_name": "A01_VVG321",
			"session_id": session_id,
			"login_id": login_id
			,"param_value1":USER_MAIN_ID
			,"param_value2":s_encode($("#ACAB4F_qry_INF_CN_NAME").val())
			,"param_value3":s_encode($("#ACAB4F_qry_INF_EN_NAME").val())
	};
	ly_index = layer.load();
	get_ajax_baseurl(inputdata, "ACAB4F_get_A01_VVG321");
}

//获取用户接口信息
function ACAB4F_get_A01_VVG321(input){
	layer.close(ly_index);
	//查询失败
    if (Call_QryResult(input.A01_VVG321) == false)
        return false;
	$("#ACAB4F_sub_proc_main").html("");
	
	var iCount = 0;
	$.each(input.A01_VVG321, function (i, obj) {
		var temMain_ID = obj["MAIN_ID"];
		var temINF_CN_NAME = s_decode(obj["INF_CN_NAME"]);
		var temCheck = "";
		if(obj["USER_MAIN_ID"] != "")
			temCheck = "checked=\"true\"";
		else
			temCheck = "";
		var target_proc = "<input id=\"ACAB4F_sub_proc_"+temMain_ID.toString()+"\" type=\"checkbox\" value=\""+temMain_ID+"\" "+temCheck+">"
	    	+"<label for=\"ACAB4F_sub_proc_"+temMain_ID.toString()+"\">"+temINF_CN_NAME+"</label>";
		iCount ++;
		if(iCount % 3 == 0)
			target_proc += "<br>";
		$("#ACAB4F_sub_proc_main").append(target_proc);
	});
}

//请求用户首页菜单信息
function ACAB4F_A01_TTTV32(USER_MAIN_ID){
	var inputdata = {
			"param_name": "A01_TTTV32",
			"session_id": session_id,
			"login_id": login_id
			,"param_value1":USER_MAIN_ID
	};
	ly_index = layer.load();
	get_ajax_baseurl(inputdata, "ACAB4F_get_A01_TTTV32");
}

//获取用户首页菜单信息
function ACAB4F_get_A01_TTTV32(input){
	layer.close(ly_index);
	//查询失败
    if (Call_QryResult(input.A01_TTTV32) == false)
        return false;
	$("#ACAB4F_sub_content").html("");
	var GROUP_ID = "";
	var iCount = 0;
	$.each(input.A01_TTTV32, function (i, obj) {
		var temMain_ID = obj["MAIN_ID"];
		var temROLE_NAME = s_decode(obj["MENU_NAME"]);
		var temCheck = "";
		var temGROUP_ID = obj["GROUP_ID"];
		if(GROUP_ID != temGROUP_ID){
			iCount = 0;
			var group_html = "<div>"
				+s_decode(obj["GROUP_CN_NAME"])
				+"</div>";
			GROUP_ID = temGROUP_ID;
			var menu_div = "<div style=\"margin-left: 10px;\" id=\"ACAB4F_sc_"+temGROUP_ID.toString()+"\">";
			$("#ACAB4F_sub_content").append(group_html);
			$("#ACAB4F_sub_content").append(menu_div);
		}
		
		iCount ++;
		if(obj["USER_MAIN_ID"] != "")
			temCheck = "checked=\"true\"";
		else
			temCheck = "";
		var target_menu = "<input id=\"ACAB4F_sub_content_"+temMain_ID.toString()+"\" name=\"ACAB4F_sub_content_rd\" type=\"radio\" value=\""+temMain_ID+"\" "+temCheck+">"
	    	+"<label for=\"ACAB4F_sub_content_"+temMain_ID.toString()+"\">"+temROLE_NAME+"</label>";
		if(iCount % 5 == 0)
			target_menu += "<br>";
		$("#ACAB4F_sub_content").find("div[id='ACAB4F_sc_"+temGROUP_ID.toString()+"']").append(target_menu);
	});
}

//请求用户菜单信息
function ACAB4F_A01_KKT774(USER_MAIN_ID){
	var inputdata = {
			"param_name": "A01_KKT774",
			"session_id": session_id,
			"login_id": login_id
			,"param_value1":USER_MAIN_ID
	};
	ly_index = layer.load();
	get_ajax_baseurl(inputdata, "ACAB4F_get_A01_KKT774");
}

//获取用户菜单信息
function ACAB4F_get_A01_KKT774(input){
	layer.close(ly_index);
	//查询失败
    if (Call_QryResult(input.A01_KKT774) == false)
        return false;
	$("#ACAB4F_sub_menu").html("");
	var GROUP_ID = "";
	var iCount = 0;
	$.each(input.A01_KKT774, function (i, obj) {
		var temMain_ID = obj["MAIN_ID"];
		var temROLE_NAME = s_decode(obj["MENU_NAME"]);
		var temCheck = "";
		var temGROUP_ID = obj["GROUP_ID"];
		if(GROUP_ID != temGROUP_ID){
			iCount = 0;
			var group_html = "<div>"
				+"<input id=\"ACAB4F_smg_ck_"+temGROUP_ID.toString()+"\" onclick=\"ACAB4F_menu_group_check(this)\" "
				+"type=\"checkbox\" value=\"ACAB4F_smg_"+temGROUP_ID.toString()+"\" >"  //checked=\"true\"
				+"<label style=\"margin-left: 10px;\" for=\"ACAB4F_smg_ck_"+temGROUP_ID.toString()+"\">"+s_decode(obj["GROUP_CN_NAME"])+"</label>"
				+"</div>";
			GROUP_ID = temGROUP_ID;
			var menu_div = "<div style=\"margin-left: 10px;\" id=\"ACAB4F_smg_"+temGROUP_ID.toString()+"\">";
			$("#ACAB4F_sub_menu").append(group_html);
			$("#ACAB4F_sub_menu").append(menu_div);
		}

		iCount ++;
		if(obj["USER_MAIN_ID"] != "")
			temCheck = "checked=\"true\"";
		else
			temCheck = "";
		var target_menu = "<input id=\"ACAB4F_sub_menu_"+temMain_ID.toString()+"\" type=\"checkbox\" value=\""+temMain_ID+"\" "+temCheck+">"
	    	+"<label for=\"ACAB4F_sub_menu_"+temMain_ID.toString()+"\">"+temROLE_NAME+"</label>";
		if(iCount % 5 == 0)
			target_menu += "<br>";
		$("#ACAB4F_sub_menu").find("div[id='ACAB4F_smg_"+temGROUP_ID.toString()+"']").append(target_menu);
	});
}

//请求用户角色信息
function ACAB4F_A01_GGR334(USER_MAIN_ID){
	var inputdata = {
			"param_name": "A01_GGR334",
			"session_id": session_id,
			"login_id": login_id
			,"param_value1":USER_MAIN_ID
	};
	ly_index = layer.load();
	get_ajax_baseurl(inputdata, "ACAB4F_get_A01_GGR334");
}

//获取用户角色信息
function ACAB4F_get_A01_GGR334(input){
	layer.close(ly_index);
	//查询失败
    if (Call_QryResult(input.A01_GGR334) == false)
        return false;
	$("#ACAB4F_sub_role").html("");
	
	var iCount = 0;
	$.each(input.A01_GGR334, function (i, obj) {
		var temMain_ID = obj["MAIN_ID"];
		var temROLE_NAME = s_decode(obj["ROLE_NAME"]);
		var temCheck = "";
		if(obj["USER_MAIN_ID"] != "")
			temCheck = "checked=\"true\"";
		else
			temCheck = "";
		var target_role = "<input id=\"ACAB4F_sub_role_"+temMain_ID.toString()+"\" type=\"checkbox\" value=\""+temMain_ID+"\" "+temCheck+">"
	    	+"<label for=\"ACAB4F_sub_role_"+temMain_ID.toString()+"\">"+temROLE_NAME+"</label>";
		iCount ++;
		if(iCount % 5 == 0)
			target_role += "<br>";
		$("#ACAB4F_sub_role").append(target_role);
	});
}

//配置信息保存
$("#ACAB4F_btn_Save").click(function (){
	var rowData = null;
	if (ACAB4F_select_user_control_rowId != "") 
		rowData = $("#ACAB4F_user_control_Events").bootstrapTable('getData')[ACAB4F_select_user_control_rowId];
	else
		rowData = ACAB4F_rowCheckData;
	
	var SUB_NAME = $("input[name='ACAB4F_user_control_rd']:checked").val();
	var NO_MAIN_ID = "";
	var SUB_MAIN_ID = "";
	if(SUB_NAME == "ACAB4F_sub_role"){
		$.each($("#"+SUB_NAME).find("input[type='checkbox']:checked"), function (i, obj) {
			if(SUB_MAIN_ID == "")
				SUB_MAIN_ID = $(obj).val();
			else
				SUB_MAIN_ID += ","+$(obj).val();
		});
		$.each($("#"+SUB_NAME).find("input[type='checkbox']:not(:checked)"), function (i, obj) {
			if(NO_MAIN_ID == "")
				NO_MAIN_ID = $(obj).val();
			else
				NO_MAIN_ID += ","+$(obj).val();
		});
		
		var inputdata = {
				"param_name": "A01_USEROL",
				"session_id": session_id,
				"login_id": login_id
				,"param_value1":SUB_MAIN_ID			//ROLE_MAIN_ID
				,"param_value2":rowData["MAIN_ID"]	//USER_MAIN_ID
				,"param_value3":NO_MAIN_ID			//NO_ROLE_MAIN_ID
				,"param_value4":"-1"				//NO_USER_MAIN_ID
		};
		ly_index = layer.load();
		get_ajax_baseurl(inputdata, "ACAB4F_get_A01_USEROL");
	}
	else if(SUB_NAME == "ACAB4F_sub_menu"){
		$.each($("#"+SUB_NAME).find("input[id^='ACAB4F_sub_menu_']:checked"), function (i, obj) {
			if(SUB_MAIN_ID == "")
				SUB_MAIN_ID = $(obj).val();
			else
				SUB_MAIN_ID += ","+$(obj).val();
		});
		$.each($("#"+SUB_NAME).find("input[id^='ACAB4F_sub_menu_']:not(:checked)"), function (i, obj) {
			if(NO_MAIN_ID == "")
				NO_MAIN_ID = $(obj).val();
			else
				NO_MAIN_ID += ","+$(obj).val();
		});

		var inputdata = {
				"param_name": "A01_USEMEU",
				"session_id": session_id,
				"login_id": login_id
				,"param_value1":SUB_MAIN_ID			//MENU_MAIN_ID
				,"param_value2":rowData["MAIN_ID"]	//USER_MAIN_ID
				,"param_value3":NO_MAIN_ID			//NO_MENU_MAIN_ID
				,"param_value4":"-1"				//NO_USER_MAIN_ID
		};
		ly_index = layer.load();
		get_ajax_baseurl(inputdata, "ACAB4F_get_A01_USEMEU");
	}
	else if(SUB_NAME == "ACAB4F_sub_content"){
		SUB_MAIN_ID = $("#"+SUB_NAME).find("input[type='radio']:checked").val();
		
		var inputdata = {
				"param_name": "A01_USECON",
				"session_id": session_id,
				"login_id": login_id
				,"param_value1":SUB_MAIN_ID			//BTN_MAIN_ID
				,"param_value2":rowData["MAIN_ID"]	//USER_MAIN_ID
				,"param_value3":"-1"			//NO_BTN_MAIN_ID
				,"param_value4":"-1"				//NO_USER_MAIN_ID
		};
		ly_index = layer.load();
		get_ajax_baseurl(inputdata, "ACAB4F_get_A01_USECON");
	}
	else if(SUB_NAME == "ACAB4F_sub_proc"){
		$.each($("#"+SUB_NAME).find("input[type='checkbox']:checked"), function (i, obj) {
			if(SUB_MAIN_ID == "")
				SUB_MAIN_ID = $(obj).val();
			else
				SUB_MAIN_ID += ","+$(obj).val();
		});
		$.each($("#"+SUB_NAME).find("input[type='checkbox']:not(:checked)"), function (i, obj) {
			if(NO_MAIN_ID == "")
				NO_MAIN_ID = $(obj).val();
			else
				NO_MAIN_ID += ","+$(obj).val();
		});
		
		var inputdata = {
				"param_name": "A01_USEPRO",
				"session_id": session_id,
				"login_id": login_id
				,"param_value1":SUB_MAIN_ID			//PROC_ID
				,"param_value2":rowData["MAIN_ID"]	//USER_MAIN_ID
				,"param_value3":NO_MAIN_ID			//NO_PROC_ID
				,"param_value4":"-1"				//NO_USER_MAIN_ID
		};
		ly_index = layer.load();
		get_ajax_baseurl(inputdata, "ACAB4F_get_A01_USEPRO");
	}
	else if(SUB_NAME == "ACAB4F_sub_btn"){
		$.each($("#"+SUB_NAME).find("input[id^='ACAB4F_sub_btn_']:checked"), function (i, obj) {
			if(SUB_MAIN_ID == "")
				SUB_MAIN_ID = $(obj).val();
			else
				SUB_MAIN_ID += ","+$(obj).val();
		});
		$.each($("#"+SUB_NAME).find("input[id^='ACAB4F_sub_btn_']:not(:checked)"), function (i, obj) {
			if(NO_MAIN_ID == "")
				NO_MAIN_ID = $(obj).val();
			else
				NO_MAIN_ID += ","+$(obj).val();
		});
		
		var inputdata = {
				"param_name": "A01_USEBTN",
				"session_id": session_id,
				"login_id": login_id
				,"param_value1":SUB_MAIN_ID			//BTN_MAIN_ID
				,"param_value2":rowData["MAIN_ID"]	//USER_MAIN_ID
				,"param_value3":NO_MAIN_ID			//NO_BTN_MAIN_ID
				,"param_value4":"-1"				//NO_USER_MAIN_ID
		};
		ly_index = layer.load();
		get_ajax_baseurl(inputdata, "ACAB4F_get_A01_USEBTN");
	}
});

//编辑用户角色关联信息
function ACAB4F_get_A01_USEROL(input){
	layer.close(ly_index);
	//操作失败
    if (Call_OpeResult(input.A01_USEROL) == false)
        return false;
}

//编辑用户菜单关联信息
function ACAB4F_get_A01_USEMEU(input){
	layer.close(ly_index);
	//操作失败
    if (Call_OpeResult(input.A01_USEMEU) == false)
        return false;
}

//编辑用户接口关联信息
function ACAB4F_get_A01_USEPRO(input){
	layer.close(ly_index);
	//操作失败
    if (Call_OpeResult(input.A01_USEPRO) == false)
        return false;
}

//编辑用户按钮关联信息
function ACAB4F_get_A01_USEBTN(input){
	layer.close(ly_index);
	//操作失败
  if (Call_OpeResult(input.A01_USEBTN) == false)
      return false;
}

//编辑用户首页关联信息
function ACAB4F_get_A01_USECON(input){
	layer.close(ly_index);
	//操作失败
  if (Call_OpeResult(input.A01_USECON) == false)
      return false;
}
